<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>用户登录</title>
  <style>
    /* 全局样式 - 与商城一致 */
    body {
      font-family: 'Arial', sans-serif;
      margin: 0;
      padding: 0;
      background-color: #f5f5f5;
      color: #333;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
    }

    /* 登录容器 - 与商城卡片样式一致 */
    .login-container {
      background-color: white;
      width: 100%;
      max-width: 400px;
      padding: 40px;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }

    /* 标题样式 - 与商城h1一致 */
    h2 {
      color: #2c3e50;
      text-align: center;
      margin-bottom: 30px;
      font-size: 1.8rem;
      position: relative;
      padding-bottom: 15px;
    }

    h2:after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 60px;
      height: 3px;
      background-color: #3498db;
    }

    /* 输入框样式 - 保持原有name属性 */
    input[type="text"],
    input[type="password"] {
      width: 100%;
      padding: 12px 15px;
      margin: 8px 0 20px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 1rem;
      transition: all 0.3s;
    }

    input[type="text"]:focus,
    input[type="password"]:focus {
      outline: none;
      border-color: #3498db;
      box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
    }

    /* 按钮样式 - 与商城导航栏活跃状态一致 */
    button {
      width: 100%;
      padding: 12px;
      margin-top: 10px;
      background-color: #3498db;
      color: white;
      border: none;
      border-radius: 4px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: background-color 0.3s;
    }

    button:hover {
      background-color: #2980b9;
    }

    /* 错误消息 - 保持原有th:if逻辑 */
    .error {
      color: #e74c3c;
      text-align: center;
      margin: 15px 0;
      padding: 10px;
      background-color: rgba(231, 76, 60, 0.1);
      border-radius: 4px;
      font-size: 0.9rem;
    }

    /* 链接样式 - 与商城一致 */
    a {
      display: block;
      text-align: center;
      margin-top: 20px;
      color: #3498db;
      text-decoration: none;
      font-size: 0.95rem;
      transition: color 0.3s;
    }

    a:hover {
      color: #2980b9;
      text-decoration: underline;
    }
  </style>
</head>
<body>

<div class="login-container">
  <h2>用户登录</h2>

  <!-- 保持原有错误显示逻辑 -->
  <div th:if="${param.error}" class="error">
    用户名或密码错误，请重试。
  </div>

  <!-- 保持原有form结构和name属性 -->
  <form th:action="@{/login}" method="post">
    <input type="text" name="username" placeholder="用户名/邮箱" required>
    <input type="password" name="password" placeholder="密码" required>
    <button type="submit">登录</button>
    <div th:if="${param.error}" class="error">用户名或密码错误</div>
  </form>

  <!-- 保持原有注册链接 -->
  <a href="/register">没有账号？去注册</a>
</div>

</body>
</html>